package org.zizi.dao;

import java.util.List;

import org.zizi.modal.VatCredit;
import org.zizi.modal.VatCreditInvoice;
import org.zizi.util.PagedList;

public interface VatCreditDao
{
	/** 添加或更新清单 */
	public long addOrUpdateVatCredit(VatCredit credit) throws Exception;
	
	/** 得到上期未抵减税额 */
	public double getPreviousLeftCredit(String identify, int year, int month) throws Exception;
	
	/** 删除清单 */
	public void deleteVatCredit(long id) throws Exception;
	
	/** 是否正在更晚的清单 */
	public boolean existLatterCredit(String identify, int year, int month, Long exclude) throws Exception;
	
	/** 获取清单 */
	public VatCredit getVatCredit(long id) throws Exception;
	
	/** 获取清单 */
	public VatCredit getVatCredit(String identify, int year, int month) throws Exception;
	
	/** 搜索清单 */
	public PagedList<VatCredit> listVatCredits(String identify, int beginYear, int beginMonth, int endYear, int endMonth, int offset, int limit) throws Exception;

//	public VatCredit getSepVatCredit(String identify, long typeId, long exclude) throws Exception;
//	
//	public VatCredit getManOrFixVatCredit(String identify, long typeId, int year, long exclude) throws Exception;
//	
//	public VatCredit getVatCreditByCodeAndNum(String code, String number, long exclude) throws Exception;

	///
	
	public void updateVatCreditInvoices(long creditId, List<VatCreditInvoice> invoices) throws Exception;
	
	public List<VatCreditInvoice> getVatCreditInvoices(long creditId) throws Exception;
	
	/** 检查发票代码和号码组合是否被使用过 */
	public VatCreditInvoice getVatCreditInvoiceByCodeAndNum(String code, String number, long exclude) throws Exception;

	/** 增值税专用发票，每种类型一辈子只能填写一次 */
	public VatCreditInvoice getSepVatCreditInvoice(String identify, long typeId, long exclude) throws Exception;

	/** 普通发票，每种类型一年只能填写一次 */
	public VatCreditInvoice getManOrFixVatCreditInvoice(String identify, long typeId, int year, long exclude) throws Exception;
}
